/*
 * Created on 03.11.2006
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.nsu.konus.control.commands;

/**
 * @author Dragon
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class Command {
	
	public static final char KEY_DOWN = 0;
	
	public static final char KEY_UP = 1;
	
	public static final char KEY_DOWN_UP = 2;
	
	public Command(String name, char key, char action) {
		this.key = key;
		this.action = action;
		this.name = name;
	}
	
	public char getAction() {
		return action;
	}
	
	public char getKey() {
		return key;
	}
	
	public String getName() {
		return name;
	}
	
	public String toString() {
		StringBuffer buf = new StringBuffer();
		buf.append("[" + name + ", " + (int)key + ", ");
		if (action == KEY_DOWN)
			buf.append("KEY_DOWN");
		else if (action == KEY_UP)
			buf.append("KEY_UP");
		else if (action == KEY_DOWN_UP)
			buf.append("KEY_DOWN_UP");
		buf.append("]");
		return buf.toString();
	}
	
	private char key;
	
	private char action;
	
	private String name;
}
